package com.cykj.pos.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cykj.pos.domain.BizIntendToNuclearBody;
import com.cykj.pos.domain.WxFaceVersion;
import com.cykj.pos.mapper.BizIntendToNuclearBodyMapper;
import com.cykj.pos.service.IBizIntendToNuclearBodyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 意愿核身Service业务层处理
 *
 * @author 许晓龙
 * @date 2022-07-11
 */
@Service
public class BizIntendToNuclearBodyServiceImpl extends ServiceImpl<BizIntendToNuclearBodyMapper, BizIntendToNuclearBody> implements IBizIntendToNuclearBodyService {

    @Resource
    private BizIntendToNuclearBodyMapper bizIntendToNuclearBodyMapper;

    @Override
    public List<BizIntendToNuclearBody> queryList(BizIntendToNuclearBody bizIntendToNuclearBody) {
        LambdaQueryWrapper<BizIntendToNuclearBody> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(bizIntendToNuclearBody.getMerchantNo())){
            lqw.eq(BizIntendToNuclearBody::getMerchantNo ,bizIntendToNuclearBody.getMerchantNo());
        }
        if (StringUtils.isNotBlank(bizIntendToNuclearBody.getOrderNo())){
            lqw.eq(BizIntendToNuclearBody::getOrderNo ,bizIntendToNuclearBody.getOrderNo());
        }
        if (StringUtils.isNotBlank(bizIntendToNuclearBody.getVideoAddress())){
            lqw.eq(BizIntendToNuclearBody::getVideoAddress ,bizIntendToNuclearBody.getVideoAddress());
        }
        if (StringUtils.isNotBlank(bizIntendToNuclearBody.getWillUserAudio())){
            lqw.eq(BizIntendToNuclearBody::getWillUserAudio ,bizIntendToNuclearBody.getWillUserAudio());
        }
        if (StringUtils.isNotBlank(bizIntendToNuclearBody.getWillReadAudio())){
            lqw.eq(BizIntendToNuclearBody::getWillReadAudio ,bizIntendToNuclearBody.getWillReadAudio());
        }
        return this.list(lqw);
    }

    @Override
    public WxFaceVersion selectWxFaceVersion() {
        return bizIntendToNuclearBodyMapper.selectWxFaceVersion();
    }

    @Override
    public void updatewxVersion(WxFaceVersion wxFaceVersion) {
        bizIntendToNuclearBodyMapper.updatewxVersion(wxFaceVersion);
    }


}
